package com.cbgolf.oa.util;

import com.cbgolf.oa.R;
import com.cbgolf.oa.manager.DataManager;
import com.cbgolf.oa.manager.OrderManager;

/**
 * Created by Administrator on 2017/9/4.
 */

public class EnumUtil {


  public static final int INITDATA = 1;
  public static final int REFRESH = INITDATA + 1;
  public static final int LOADMORE = REFRESH + 1;

  public static final int BOOK = 1;
  public static final int MATCH = 2;
  public static final int GROUP_BOOK = 3;
  public static final int GROUP_MATCH = 4;

  public static final int RETUNE_BOOK = 5;
  public static final int RETUNE_MATCH = 6;
  public static final int RETUNE_GROUP_BOOK = 7;
  public static final int RETUNE_GROUP_MATCH = 8;
  public static final int CHANGE_BOOK = 9;
  public static final int CHANGE_GROUP_BOOK = 10;
  public static final int ORDER_DETAILS_BOOK = 11;
  public static final int ORDER_DETAILS_MATCH = 12;
  public static final int HOTEL = 13;
  public static final int RETUNE_HOTEL = 14;
  public static final int COMBO = 15;


  public static final int CLOSE_PARK_SHOW_DETAILS = 1;
  public static final int CLOSE_PARK_ADD_NEW = 2;

  public static boolean isMatch(int type) {
    boolean is = false;
    switch (type) {
      case MATCH:
      case ORDER_DETAILS_MATCH:
        is = true;
        break;
      default:
        break;
    }
    return is;
  }


  public static String getStatisticsUnit(int mType) {
    String unit = "";
    switch (mType) {
      case DataManager.STATISTICS_BILL_ALL:
      case DataManager.STATISTICS_BUSINESS_ALL:
        unit = "元";
        break;
      case DataManager.STATISTICS_BOOK_ALL:
      case DataManager.STATISTICS_PLAYER_ALL:
        unit = "人";
        break;
      case DataManager.STATISTICS_CADDIE_ALL:
        unit = "次";
        break;
      default:
        break;

    }
    return unit;

  }

  public static String getCouponType(String obj) {
    String type = "";
    if (Util.isNull(obj)) {
      return type;
    }
    switch (obj) {
      case "CB":
        type = "通用券";
        break;
      case "COURT":
        type = "专用券";
        break;
      case "TICKET":
        type = "专用券";
        break;
    }
    return type;

  }

  //    优惠券类型:
//    博券(通用券);
//    球场优惠券(专用券) =['CB','COURT','TICKET']stringEnum:"CB","COURT","TICKET",
  public static String getParkState(String obj) {
    if (Util.isNull(obj)) {
      return "";
    }
    String type = "";
    switch (obj) {
      case "UNBLOCKED":
        type = "正常";
        break;
      case "LEISURE":
        type = "顺畅";
        break;
      case "CONGESTION":
        type = "拥堵";
        break;
    }
    return type;

  }

  //    UNBLOCKED("畅通"),
//    LEISURE("空闲"),
//    CONGESTION("拥堵");
  public static int getParkStateRes(String obj) {
    int type = R.drawable.oval_yellow;
    if (Util.isNull(obj)) {
      return type;
    }
    switch (obj) {
      case "UNBLOCKED":
        type = R.drawable.oval_yellow;
        break;
      case "LEISURE":
        type = R.drawable.oval_blue;
        break;
      case "CONGESTION":
        type = R.drawable.oval_red_park;
        break;
      default:
        break;
    }
    return type;

  }

  //    NOW:立即，TIMING:定时
  public static String getSendType(String obj) {
    String res = "";
    if (Util.isNull(obj)) {
      return res;
    }
    switch (obj) {
      case "NOW":
        res = "即时";
        break;
      case "TIMING":
        res = "定时";
        break;
    }
    return res;
  }

  //    "MALE", "FEMALE",
  public static String getGender(String obj) {
    String res = "男、女";
    if (Util.isNull(obj)) {
      return res;
    }
    switch (obj) {
      case "MALE":
        res = "男";
        break;
      case "FEMALE":
        res = "女";
        break;
    }
    return res;
  }


  public static int getOrderType(String orderType) {

    if (TextUtil.contains(orderType, OrderManager.COMBO_TEXT_ZH)) {
      return COMBO;
    } else if (TextUtil.contains(orderType, OrderManager.HOTEL_TEXT_ZH)) {
      return HOTEL;
    } else if (TextUtil.contains(orderType, OrderManager.GROUP_TEXT_ZH)) {
      return GROUP_BOOK;
    } else if (TextUtil.contains(orderType, OrderManager.MATCH_TEXT_ZH)) {
      return MATCH;
    } else {
      return BOOK;
    }

  }

  public static boolean isHotel(int type) {
    boolean is = false;
    switch (type) {
      case HOTEL:
      case RETUNE_HOTEL:
        is = true;
        break;
      default:
        break;
    }
    return is;
  }

  public static boolean isCombo(int type) {
    boolean is = false;
    switch (type) {
      case COMBO:
        is = true;
        break;
      default:
        break;
    }
    return is;
  }

  public static String getTitleOfListStatistics(int type) {
    String title;
    switch (type) {
      case DataManager.STATISTICS_BUSINESS_ALL:
        title = "";
        break;
      case DataManager.STATISTICS_BOOK_ALL:
        title = "";
        break;
      case DataManager.STATISTICS_CADDIE_ALL:
        title = "";
        break;
      case DataManager.STATISTICS_BILL_ALL:
        title = "";
        break;
      case DataManager.STATISTICS_PLAYER_ALL:
        title = "";
        break;
      default:
        title = "";
        break;
    }
    return title;
  }

  public static boolean isFromApp(String from) {
    return Util.isEquals(from, "APP");
  }

  public static String getCloseParkCause(String reason) {
    String res = "封场";
    if (Util.isNull(reason)) {
      return res;
    }
    switch (reason) {
      case "COMPETITION":
        res = "比赛\n封场";
        break;
      case "ACTIVITY":
        res = "活动\n封场";
        break;
      case "MAINTAIN":
        res = "养护\n封场";
        break;
      case "CLOSED":
        res = "闭场\n封场";
        break;
      case "OTHER":
        res = "其他封场";
        break;
      default:
        break;
    }
    return res;
  }

}
